<?php
/**
 * UserGroup Model
 *
 * PHP Version 5
 *
 * @package    Ecga
 * @subpackage Models
 * @author     sunfengming <sunfengming@ec3s.com>
 * @copyright  2010 Xingchangxinda Inc.
 * @version    SVN:$Id: masters.php 3051 2011-01-11 13:06:18Z sunbo $
 */

namespace Project\Apps\Ecga\Models;

use Project\Models\Abstraction\Ecga\UserGroup as AbsUserGroup;
/**
 * UserGroup Model
 *
 * PHP version 5
 *
 * @package   Ecga
 * @author    sunfengming <sunfengming@ec3s.com>
 * @copyright 2010 Xingchangxinda Inc.
 * @version   Release: 0.1
 */

class UserGroup extends AbsUserGroup
{
    /**
     * 取分页query
     *
     * @return query $query
     * @author sunfengming
     */
    public static function getPageQuery()
    {
        $userGroupModel = model('UserGroup');
        
        return $userGroupModel->query($userGroupModel->filter())->fields('id', 'groupName');
    }

    /**
     * 获取分组下拉选项信息
     * 
     * @return array
     */
    public function getAllGroupOption()
    {
        $result = $this->select(
            'id', 'groupName'
        )->fetch();
        $return = array();
        foreach ($result as $group) {
            $return[$group['id']] = $group['groupName'];
        }
        return $return;
    }
}